﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace common
{
    class offers
    {
    }
    #region 公共用例
    public class SimpleTaker
    {
        public string currency { get; set; }
    }

    public class RichTaker
    {
        public string value { get; set; }
        public string currency { get; set; }
        public string issuer { get; set; }
    }
    public class TakerFunded
    {
        public string currency { get; set; }
        public string issuer { get; set; }
        public string value { get; set; }
    }
    #endregion

    #region 查询购买行情buyXRP
    public class buyXRP
    {
        public int id { get; set; }
        public string command { get; set; }
        public string taker { get; set; }
        public SimpleTaker taker_pays { get; set; }
        public RichTaker taker_gets { get; set; }
        public int limit { get; set; }
    }


    

    public class buyRXPOffer
    {
        public string Account { get; set; }
        public string BookDirectory { get; set; }
        public string BookNode { get; set; }
        public int Flags { get; set; }
        public string LedgerEntryType { get; set; }
        public string OwnerNode { get; set; }
        public string PreviousTxnID { get; set; }
        public int PreviousTxnLgrSeq { get; set; }
        public int Sequence { get; set; }
        public RichTaker TakerGets { get; set; }
        public string TakerPays { get; set; }
        public string index { get; set; }
        public string quality { get; set; }
        public TakerFunded taker_gets_funded { get; set; }
        public string taker_pays_funded { get; set; }
    }

    public class buyXRPResult
    {
        public int ledger_current_index { get; set; }
        public List<buyRXPOffer> offers { get; set; }
    }

    public class buyXRPresponse
    {
        public int id { get; set; }
        public string status { get; set; }
        public string type { get; set; }
        public buyXRPResult result { get; set; }
    }
    #endregion
    /************行情***出售RXP********************************************************************************/
    #region 查询出售RXP行情
    public class sellRXP
    {
        public int id { get; set; }
        public string command { get; set; }
        public string taker { get; set; }
        public SimpleTaker taker_gets { get; set; }
        public RichTaker taker_pays { get; set; }
        public int limit { get; set; }
    }
    public class sellRXPOffer
    {
        public string Account { get; set; }
        public string BookDirectory { get; set; }
        public string BookNode { get; set; }
        public int Flags { get; set; }
        public string LedgerEntryType { get; set; }
        public string OwnerNode { get; set; }
        public string PreviousTxnID { get; set; }
        public int PreviousTxnLgrSeq { get; set; }
        public int Sequence { get; set; }
        public string TakerGets { get; set; }
        public RichTaker TakerPays { get; set; }
        public string index { get; set; }
        public string quality { get; set; }
    }

    public class sellRXPResult
    {
        public int ledger_current_index { get; set; }
        public List<sellRXPOffer> offers { get; set; }
    }

    public class sellRXPresponse
    {
        public int id { get; set; }
        public string status { get; set; }
        public string type { get; set; }
        public sellRXPResult result { get; set; }
    }
#endregion

    #region 查询真实货币交易行情
    public class moneytrading
    {
        public int id { get; set; }
        public string command { get; set; }
        public string taker { get; set; }
        public RichTaker taker_gets { get; set; }
        public RichTaker taker_pays { get; set; }
        public int limit { get; set; }
    }
    public class moneytradingOffer
    {
        public string Account { get; set; }
        public string BookDirectory { get; set; }
        public string BookNode { get; set; }
        public int Flags { get; set; }
        public string LedgerEntryType { get; set; }
        public string OwnerNode { get; set; }
        public string PreviousTxnID { get; set; }
        public int PreviousTxnLgrSeq { get; set; }
        public int Sequence { get; set; }
        public RichTaker TakerGets { get; set; }
        public RichTaker TakerPays { get; set; }
        public string index { get; set; }
        public string quality { get; set; }
        public TakerFunded taker_gets_funded { get; set; }
        public TakerFunded taker_pays_funded { get; set; }
    }

    public class moneytradingResult
    {
        public int ledger_current_index { get; set; }
        public List<moneytradingOffer> offers { get; set; }
    }

    public class moneytradingResponse
    {
        public int id { get; set; }
        public string status { get; set; }
        public string type { get; set; }
        public moneytradingResult result { get; set; }
    }
    #endregion

    #region 帐户资金
    /// <summary>
    /// 账户查询用的公共命令格式，
    /// command=account_info，查xrp存款
    /// command=account_lines,查账户资金
    /// </summary>
    public class accountCommand
    {
        public int id { get; set; }
        public string command { get; set; }//
        public string account { get; set; }
    }
    public class accountlinesLine
    {
        public string account { get; set; }
        public string balance { get; set; }
        public string currency { get; set; }
        public string limit { get; set; }
        public string limit_peer { get; set; }
        public bool no_ripple { get; set; }
        public int quality_in { get; set; }
        public int quality_out { get; set; }
    }

    public class accountlinesResult
    {
        public string account { get; set; }
        public List<accountlinesLine> lines { get; set; }
    }
    /// <summary>
    /// 帐户资金情况返回，可得各网关钱钱情况
    /// </summary>
    public class accountlinesResponse
    {
        public int id { get; set; }
        public accountlinesResult result { get; set; }
        public string status { get; set; }
        public string type { get; set; }
    }
    #endregion

    #region 帐户xrp
    public class AccountData
    {
        public string Account { get; set; }
        public string Balance { get; set; }
        public int Flags { get; set; }
        public string LedgerEntryType { get; set; }
        public int OwnerCount { get; set; }
        public string PreviousTxnID { get; set; }
        public int PreviousTxnLgrSeq { get; set; }
        public int Sequence { get; set; }
        public string index { get; set; }
    }

    public class accountinfoResult
    {
        public AccountData account_data { get; set; }
        public int ledger_current_index { get; set; }
    }
    /// <summary>
    /// 查看帐户情况返回串，可得xrp数
    /// </summary>
    public class accountinfoResponse
    {
        public int id { get; set; }
        public string status { get; set; }
        public string type { get; set; }
        public accountinfoResult result { get; set; }
    }
    #endregion

    #region 提交订单 ,用xrp换其它币种,takergets=实际xrp*1000000

    /// <summary>
    /// 提交订单 ,用xrp换其它币种,takergets=实际xrp*1000000
    /// </summary>
    public class OR_soldXRPTxJson
    {
        public int Flags { get; set; }
        public string TransactionType { get; set; }
        public string Account { get; set; }
        public string TakerGets { get; set; }
        public RichTaker TakerPays { get; set; }
    }

    public class OR_soldXRP4money
    {
        public int id { get; set; }
        public string command { get; set; }
        public string secret { get; set; }
        public OR_soldXRPTxJson tx_json { get; set; }
    }
    #endregion

    #region 提交订单 ,用其它币种买XRP,takerPAYs=实际xrp*1000000

    /// <summary>
    /// 提交订单 ,用其它币种买XRP,takerPAYs=实际xrp*1000000
    /// </summary>
    public class OR_buyXRPTxJson
    {
        public int Flags { get; set; }
        public string TransactionType { get; set; }
        public string Account { get; set; }
        public string TakerPays { get; set; }
        public RichTaker TakerGets { get; set; }
    }

    public class OR_buyXRP
    {
        public int id { get; set; }
        public string command { get; set; }
        public string secret { get; set; }
        public OR_buyXRPTxJson tx_json { get; set; }
    }
    #endregion

    #region 货币交易，用gets换pays
    public class OR_TxJson
    {
        public int Flags { get; set; }
        public string TransactionType { get; set; }
        public string Account { get; set; }
        public RichTaker TakerGets { get; set; }
        public RichTaker TakerPays { get; set; }
    }

    /// <summary>
    /// 货币交易
    /// </summary>
    public class OR_Currencytrading
    {
        public string command { get; set; }
        public string secret { get; set; }
        public OR_TxJson tx_json { get; set; }
    }
#endregion
}
